public class Client {
    public static void main(String[] args) {

        // 1.真实角色
        UserDao userDao = new UserDao();

        // 2.动态生成代理角色
        UserProxyFactory userProxyFactory = new UserProxyFactory();
        // 设置目标对象
        userProxyFactory.setTarget(userDao);

        // 3.获取代理对象
        IUserDao proxy = (IUserDao) userProxyFactory.getProxy();

        proxy.add();
        proxy.delete();

    }
}
